<!--企业风险详情-->
<template>
	<view>
		<view class="texttxt txt">
			企业风险详情</view>
		<view class="order">
			<view>
				<!--告警表单-->
				<view class="cu-form-group">
					<view class="title">风险等级</view>
						<input class="inputone" :placeholder="risk_level[qyfxxqListData.riskLevel]" disabled="disabled" placeholder-class="cl"></input>
					<!-- 	<button class='cu-btn bg-green'>已处理</button> -->
					<!-- <u-button style="width:100px; margin-left:0px" type="error" shape="circle" size="small"
						:plain="true" text="未处理">
					</u-button> -->	
					<!-- <image src="@/static/wcl.png" class="imgWH">
						</image> -->
					<image v-if="zt" src="@/static/ycl.png" class="imgWH">
					</image>
				</view>

				<view class="cu-form-group">
					<view class="title">风险总值</view>
					<input class="inputone" :placeholder="qyfxxqListData.riskValue" disabled="disabled" placeholder-class="cl"></input>
				</view>
				<view class="cu-form-group">
					<view class="title">预警时间</view>
					<input :placeholder="parseInt(qyfxxqListData.createTime) | dateFormat " name="input" disabled="disabled"
						placeholder-class="cl"></input>
				</view>
				<view class="cu-form-group">
					<view class="title">所属企业</view>
					<input :placeholder="qyfxxqListData.enterpriesName" name="input" disabled="disabled" placeholder-class="cl"></input>
					<text class='cuIcon-locationfill text-orange'></text>
				</view>
				<view class="cu-form-group">
					<view class="title">负责人</view>
					<input :placeholder="qyfxxqListData.primaryDirectorName" name="input" disabled="disabled" placeholder-class="cl"></input>

				</view>
				<view class="cu-form-group">
					<view class="title">联系方式</view>
					<input name="input" disabled="disabled" placeholder-class="cl" :placeholder="qyfxxqListData.primaryDirectorPhone"></input>

				</view>



				<view class="cu-form-group">
					<view class="title">坐标位置</view>
					<input name="input" disabled="disabled" placeholder-class="cl">{{qyfxxqListData.longitude}}{{qyfxxqListData.latitude}}</input>
				</view>
				<view class="cu-form-group">
					<view class="title">详细地址</view>
					<input :placeholder="qyfxxqListData.address" name="input" disabled="disabled" placeholder-class="cl"></input>
				</view>


			</view>
		</view>
	</view>

	</view>
</template>
<script>
	import {qyfxxqList} from "@/api/sj/qyfxxq.js"
	import { mapState } from 'vuex'//引入mapState
	export default {
		data() {
			return {
				qyfxxqListData:{},
				zt: false,
				names: "重大风险",
				dfx: false,
				bgIcon: "#1f60aa",
				bgBorder: "#1f60aa",
				src: '',
				danmuList: [{
						text: '第 1s 出现的弹幕',
						color: '#ff0000',
						time: 1
					},
					{
						text: '第 3s 出现的弹幕',
						color: '#ff00ff',
						time: 3
					}
				],
				danmuValue: '',
				dadate: [

					{
						name: "企业负责人",
						title: "王华"
					},
					{
						name: "联系电话",
						title: "15826562556"
					},
					{
						name: "企业风险等级",
						title: "非风险"
					},
					{
						name: "企业风险总值",
						title: "226"
					},
					{
						name: "今日巡查",
						title: "15826562556"
					},
					{
						name: "今日隐患",
						title: "226分"
					},
					{
						name: "今日警告",
						title: "15826562556"
					},
					{
						name: "今日下井",
						title: "226分"
					},
					{
						name: "历史事故",
						title: "226分"
					}

				],
				fileList1: [], //上传照片
				fileList2: [], //上传视频
				active: 0,
				list1: [{
					title: '未处理'
				}, {
					title: '已下发'
				}, {
					title: '已上报'
				}, {
					title: '已处理'
				}],
				zb: "12313113.15152",
				items: ['告警信息', '企业档案', '人员信息'],
				styles: [{
						value: 'button',
						text: '按钮',
						checked: true
					},
					{
						value: 'text',
						text: '文字'
					}
				],
				colors: ['#007aff', '#4cd964', '#dd524d'],
				current: 0,
				colorIndex: 0,
				activeColor: '#225EA4',
				styleType: 'button'
			}



		},
		onLoad(option) {
			// let {id} = this.$route.query
			
			this.getQyfxxqList(option.id)
		},
		onReady: function(res) {
			// #ifndef MP-ALIPAY
			this.videoContext = uni.createVideoContext('myVideo')
			// #endif
		},
	computed: {
				...mapState({
					risk_level: state => state.sjzd.sjzdList.risk_level,
				})
			},
		mounted() {
			// console.log(this.$route.query)

		},
		methods: {

			onClickItem(e) {
				if (this.current !== e.currentIndex) {
					this.current = e.currentIndex
				}
			},
			styleChange(e) {
				if (this.styleType !== e.detail.value) {
					this.styleType = e.detail.value
				}
			},
			colorChange(e) {
				if (this.styleType !== e.detail.value) {
					console.log(e.detail.value);
					this.activeColor = e.detail.value
				}
			},
			//不骤条
			change() {
				if (this.active < this.list1.length - 1) {
					this.active += 1
				} else {
					this.active = 0
				}
			},
			// 删除图片
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1)
			},
			// 新增图片
			async afterRead(event) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList${event.name}`].length
				lists.map((item) => {
					this[`fileList${event.name}`].push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					let item = this[`fileList${event.name}`][fileListLen]
					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
			},
			uploadFilePromise(url) {
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: 'http://192.168.2.21:7001/upload', // 仅为示例，非真实的接口地址
						filePath: url,
						name: 'file',
						formData: {
							user: 'test'
						},
						success: (res) => {
							setTimeout(() => {
								resolve(res.data.data)
							}, 1000)
						}
					});
				})
			},

			// 视频
			sendDanmu: function() {
				this.videoContext.sendDanmu({
					text: this.danmuValue,
					color: this.getRandomColor()
				});
				this.danmuValue = '';
			},
			videoErrorCallback: function(e) {
				uni.showModal({
					content: e.target.errMsg,
					showCancel: false
				})
			},
			getRandomColor: function() {
				const rgb = []
				for (let i = 0; i < 3; ++i) {
					let color = Math.floor(Math.random() * 256).toString(16)
					color = color.length == 1 ? '0' + color : color
					rgb.push(color)
				}
				return '#' + rgb.join('')
			},
			
			// 企业风险详情数据
			getQyfxxqList(warnId) {
				qyfxxqList(warnId).then((result)=>{
					const data = result.data
					this.qyfxxqListData = data
				}).catch((err)=>{console.log(err)})
			},


		}
	};
</script>

<style lang="scss" scoped>
	/* #ifndef H5 */
	page {
		height: 100%;
		background-color: #f2f2f2;
	}

	/* #endif */
</style>

<style lang="scss" scoped>
	.order {
		width: 710rpx;
		margin: 20rpx auto;
		border-radius: 20rpx;
		box-sizing: border-box;
		padding: 20rpx;
		font-size: 28rpx;
		background: #FFFFFF;
		box-shadow: 0px 3px 10px 0px rgba(148, 177, 188, 0.38);
		border-radius: 8px;
		height: 1100rpx;

		.top {
			display: flex;
			justify-content: space-between;

			.left {
				display: flex;
				align-items: center;

				.store {
					margin: 0 10rpx;
					font-size: 34rpx;
					font-weight: bold;
				}
			}

			// .right {
			// 	color: $u-type-warning-dark;

			// 	.progressBox {
			// 		width: 150rpx;
			// 		float: right;
			// 	}
			// }
		}

		.item {
			display: flex;
			margin: 20rpx 0 0;

			.left {
				margin-right: 20rpx;

				image {
					width: 260rpx;
					height: 190rpx;
					border-radius: 10rpx;
				}
			}

			.content {
				.title {
					font-size: 28rpx;
					line-height: 45rpx;
				}

				.type {
					margin: 6rpx 0;
					font-size: 24rpx;
					color: $u-tips-color;
					text-overflow: -o-ellipsis-lastline;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 3;
					line-clamp: 3;
					-webkit-box-orient: vertical;
				}

				.delivery-time {
					color: #0081ff;
					font-size: 24rpx;
				}
			}

			.right {
				margin-left: 10rpx;
				padding-top: 20rpx;
				text-align: right;

				.decimal {
					font-size: 24rpx;
					margin-top: 4rpx;
				}

				.number {
					color: $u-tips-color;
					font-size: 24rpx;
				}
			}
		}

		.total {
			margin-top: 20rpx;
			text-align: right;
			font-size: 24rpx;

			.total-price {
				font-size: 32rpx;
			}
		}

		.bottom {
			line-height: 70rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.btnBox {
				width: 150rpx;
				display: flex;
				justify-content: space-between;

				.btn {
					line-height: 52rpx;
					width: 140rpx;
					border-radius: 12rpx;
					border: 2rpx solid $u-tips-color;
					font-size: 26rpx;
					text-align: center;
					color: $u-tips-color;
				}

				// .evaluate {
				// 	color: $u-type-primary;
				// 	border-color: $u-type-primary;
				// }
			}
		}
	}

	.centre {
		text-align: center;
		margin: 200rpx auto;
		font-size: 32rpx;

		image {
			width: 300rpx;
			border-radius: 50%;
			margin: 0 auto;
		}

		.tips {
			font-size: 24rpx;
			color: #999999;
			margin-top: 20rpx;
		}

		.btn {
			margin: 80rpx auto;
			width: 200rpx;
			border-radius: 32rpx;
			line-height: 64rpx;
			color: #ffffff;
			font-size: 26rpx;
			background: linear-gradient(270deg, #1cbbb4 0%, #0081ff 100%);
		}
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
	}

	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}




	.example-body {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		padding: 0;
	}

	.uni-common-mt {
		margin-top: 15px;
	}

	.uni-padding-wrap {
		// width: 750rpx;
		padding: 0px 30px;
	}

	.content {
		/* #ifndef APP-NVUE */
		//display: flex;
		/* #endif */
		//justify-content: center;
		//align-items: center;
		//height: 150px;
		text-align: center;
	}

	.content-text {
		font-size: 14px;
		color: #666;
	}

	.color-tag {
		width: 25px;
		height: 25px;
	}

	.uni-list {
		flex: 1;
	}

	.uni-list-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		flex-direction: row;
		background-color: #FFFFFF;
	}


	.uni-list-item__container {
		padding: 12px 15px;
		width: 100%;
		flex: 1;
		position: relative;
		/* #ifndef APP-NVUE */
		display: flex;
		box-sizing: border-box;
		/* #endif */
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-bottom-style: solid;
		border-bottom-width: 1px;
		border-bottom-color: #eee;
	}

	.uni-list-item__content-title {
		font-size: 14px;
	}

	.texttxt {
		text-align: start;
		font-size: 14px;
		font-weight: bold;
		line-height: 50px;
	}

	.status-btn {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
		justify-content: center;
		height: 92rpx;
		margin: 30rpx;
		background-color: #007AFF;
	}

	.example-body {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		padding: 15px;
		flex-direction: row;
	}

	.segmented-control__item[data-v-064e9cd1] {
		display: inline-flex;
		box-sizing: border-box;
		position: relative;
		flex: 1;
		justify-content: center;
		align-items: center;
		margin-right: 15px;
	}

	.texttxt {
		text-align: start;
		font-size: 16px;
		font-weight: 600;
		line-height: 5px;
	}

	.orderview {
		padding: 15px;
		margin-top: -13px;
		padding-left: 0px;
		padding-right: 0px;
	}

	.slot-icon {
		width: 53px;
		height: 53px;
		background-color: rgba(216, 216, 216, 0.22);
		border: 1px solid #DADADA;
		border-radius: 100px;
		font-size: 16px;
		color: #fff;
		line-height: 21px;
		text-align: center;
	}

	.slot-icons {
		width: 53px;
		height: 53px;
		background-color: #d3dfed;
		border: 1px solid #2c65a8;
		border-radius: 100px;
		font-size: 16px;
		color: #fff;
		line-height: 21px;
		text-align: center;
	}

	::v-deep .u-steps-item__wrapper__circle {
		width: 20px;
		height: 20px;
		box-sizing: border-box;
		flex-shrink: 0;
		border-radius: 100px;
		border-width: 1px;
		border-color: #909193;
		border-style: solid;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		transition: background-color 0.3s;
	}

	::v-deep .u-steps-item__wrapper--row[data-v-73722340] {
		width: 56px;
		height: 56px;
	}

	::v-deep .u-steps-item__line--row[data-v-73722340] {
		top: 28px;
		height: 1px;
	}

	::v-deep .u-text__value--content[data-v-2bf12040] {
		color: #464646;
	}

	::v-deep .u-text__value--main[data-v-2bf12040] {
		color: #464646;
	}

	::v-deep [data-v-0b41208f] .u-text__value--content[data-v-2bf12040] {
		color: #464646;
		font-size: 16px;
	}

	.cu-form-group .title {
		color: #848484;
	}


	.cl {
		color: #343434;
	}

	.imgWH {
		width: 128rpx;
		height: 128rpx;
	}

	.nameview {
		height: 62px;
		text-align: center;
		color: rgb(34, 17, 51);
		font-size: 16px;
		background: rgb(250, 250, 250);
		line-height: 39px;
		width: 391px;
		margin: -10px auto;
		border-radius: 5px 5px 0px 0px;
		/* border-radius: 8px; */
		box-sizing: border-box;
		border-bottom: 1px solid #efeeee;
		padding: 13px;
		box-shadow: 0px 3px 10px 0px rgba(148, 177, 188, 0.38);
		// box-shadow: rgb(148 177 188 / 38%) 0px 3px 10px 0px;
	}

	.txt {
		width: 391px;
		padding: 13px;
		padding-left: 33px;
		margin: 12px 0px -3px 0px;
	}
</style>
